<template>
	<view class="page-container">
		<view class="page-body">
			<view class="card-layout">
				<block v-for="(item, index) in pageList" :key="index">
					<view class="card" @click="navPageHandle(item)">
						<text class="title">{{item.title}}</text>
						<image class="image" :src="item.coverImage" mode="aspectFill"></image>
						<view class="tips" v-if="item.notice">
							预告
						</view>
					</view>
				</block>
			</view>
			<view class="footer">
				<text>2021-2023 @ aYuan By 小功能大智慧</text>
				<text @click="copyGiteeSrc">Gitee 开源地址</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				pageList: [{
					path: '../views/bilibili',
					title: '高仿B站电磁力页面',
					date: '2021-10-09',
					notice: false,
					coverImage: 'https://mp-e93e0c5f-05cf-4713-9d34-a6449768f5b0.cdn.bspapp.com/cloudstorage/86854a24-25df-49fa-ac6f-a4731b24be8f.jpg'
				}, {
					path: '../views/cameraCanvas',
					title: '自拍合影canvas画图',
					date: '2023-03-29',
					notice: false,
					coverImage: 'https://mp-e93e0c5f-05cf-4713-9d34-a6449768f5b0.cdn.bspapp.com/cloudstorage/43aef3b8-2cd4-477e-9354-b57544567c05.png'
				}, {
					path: '',
					title: '基于三角函数的图像操作',
					date: '2021-10-09',
					notice: true,
					coverImage: 'https://mp-e93e0c5f-05cf-4713-9d34-a6449768f5b0.cdn.bspapp.com/cloudstorage/ad479f33-174f-4ecb-acc2-22f06a44e724.jpg'
				}]
			};
		},
		onShareAppMessage() {
			
		},
		methods: {
			navPageHandle(view) {
				if (!view.notice) {
					uni.navigateTo({
						url: view.path
					})
				} else {
					uni.showToast({
						title: '敬请期待',
						icon: 'none',
						duration: 1000
					})
				}
			},
			// 复制开源地址
			copyGiteeSrc () {
				uni.setClipboardData({
					data: 'https://gitee.com/aYuan-git/mini-example-of-case'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	$color-text: #fff;
	.page-container {
		.page-body {
			.card-layout {
				padding: 30rpx;
				.card {
					position: relative;
					margin-bottom: 20rpx;
					.image {
						width: 100%;
						height: 200rpx;
						border-radius: 30rpx;
						vertical-align: middle;
						background-color: #f6f6f6;
					}
					.title {
						position: absolute;
						left: 20rpx;
						bottom: 20rpx;
						font-size: 36rpx;
						color: rgba($color: $color-text, $alpha: 1.0);
					}
					.tips {
						display: inline-flex;
						background-color: $uni-color-warning;
						color: $color-text;
						border-radius: 0 999px 999px 0;
						padding: 10rpx 20rpx;
						position: absolute;
						left: 0rpx;
						top: 0rpx;
					}
				}
			}
			.footer {
				display: flex;
				flex-direction: column;
				justify-content: center;
				align-items: center;
				width: 100%;
				font-size: 24rpx;
				position: fixed;
				bottom: 0;
				padding: 30rpx;
				text-align: center;
				background-color: $color-text;
				text-align: center;
				color: $uni-color-subtitle;
				text {
					margin-bottom: 10rpx;
				}
			}
		}
	}
</style>
